<?php
/**
 * User: Drery
 * Date: 2015/11/28
 * Time: 19:06
 * @var $this \yii\web\View
 */
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\captcha\Captcha;

\backend\assets\AdminAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta charset="utf-8"/>
    <title>登录页</title>

    <meta name="description" content="User login page"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
    <?= Html::csrfMetaTags() ?>
    <?php $this->head() ?>
</head>

<body class="hold-transition login-page">
<?php $this->beginBody() ?>
<div class="login-box">
    <div class="login-logo">
        <b>豫安行后台管理</b>
    </div><!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">登录系统</p>
        <?php $form = ActiveForm::begin(["action" => "/public/login", "method" => "post"]); ?>

        <div class="form-group has-feedback">
            <?= $form->field($model, 'user_name', ['template' =>
                " {input}<span class=\"glyphicon glyphicon-user form-control-feedback\"></span>\n{hint}\n{error}",
            ])->textInput(['placeholder' => '用户名', 'class' => 'form-control']) ?>
        </div>
        <div class="form-group has-feedback">
            <?= $form->field($model, 'password', ['template' =>
                "{input}<span class=\"glyphicon glyphicon-lock form-control-feedback\"></span>\n{hint}\n{error}",
            ])->passwordInput(['placeholder' => '密码', 'class' => 'form-control']) ?>
        </div>
        <?= $form->field($model, 'verify_code', ['parts' => ['{label}' => '']])->widget(Captcha::className(), [
            'template' => '<div class="row"><div class="col-lg-6">{input}</div><div class="col-lg-6">{image}</div></div>',
            'captchaAction' => 'public/captcha',
            'options' => [
                'class' => 'form-control',
                'placeholder' => '验证码'
            ]
        ]) ?>
        <div class="row">
            <div class="col-xs-4 col-xs-offset-8">
                <button type="submit" class="btn btn-primary btn-block btn-flat">登录
                </button>
            </div>
        </div>

        <div class="space-4"></div>
        <?php ActiveForm::end(); ?>
    </div><!-- /.login-box-body -->
</div><!-- /.login-box -->

<!-- jQuery 2.1.4 -->
<script src="/plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- iCheck -->
<script src="/plugins/iCheck/icheck.min.js"></script>

<!-- inline scripts related to this page -->
<script type="text/javascript">
    jQuery(function ($) {
        $(document).on('click', '.toolbar a[data-target]', function (e) {
            e.preventDefault();
            var target = $(this).data('target');
            $('.widget-box.visible').removeClass('visible');//hide others
            $(target).addClass('visible');//show target
        });
    });


    //you don't need this, just used for changing background
    jQuery(function ($) {
        $('#btn-login-dark').on('click', function (e) {
            $('body').attr('class', 'login-layout');
            $('#id-text2').attr('class', 'white');
            $('#id-company-text').attr('class', 'blue');

            e.preventDefault();
        });
        $('#btn-login-light').on('click', function (e) {
            $('body').attr('class', 'login-layout light-login');
            $('#id-text2').attr('class', 'grey');
            $('#id-company-text').attr('class', 'blue');

            e.preventDefault();
        });
        $('#btn-login-blur').on('click', function (e) {
            $('body').attr('class', 'login-layout blur-login');
            $('#id-text2').attr('class', 'white');
            $('#id-company-text').attr('class', 'light-blue');

            e.preventDefault();
        });

    });
</script>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

